#ifndef __DEV_TIMER_H__
#define __DEV_TIMER_H__

#include "Includes.h"
#include <APP_Charging.h>
#include <APP_Bill.h>

static inline int ttimer_test(void *pParameter)
{
    //printf("do timer test\r\n");
    return 0;
}


typedef enum
{
    DEV_TIMER_TEST_TIMERID=0,//测试
    APP_CHG_STOPCHG_CHK_TIMERID,//停充超时监测
    APP_GUN1_BILL_TIMERID,//枪1计费周期定时器
    APP_GUN2_BILL_TIMERID,//枪2计费周期定时器
    MAX_TIMERID
}EN_TIMERID;


typedef struct
{
    U32 timerid;//定时器ID
    U32 tick;   //tick计时
    U32 expires;//超时时间，单位ms
    U8  cycle;//0.单次定时,1.循环定时器
    int (*pfunc)(void *pParameter);//超时处理函数
    void *pParameter;//超时函数参数
}TICK_TIMER_ST;

//定时器参数
extern U8 BillTimerPara[GUN_NUM_MAX];

//定时器定义
#define TTIMER_DEF    \
{\
    {DEV_TIMER_TEST_TIMERID,0,5000,1,ttimer_test,NULL},\
    {APP_CHG_STOPCHG_CHK_TIMERID,0,6000,0,StopChgChkTimer,NULL},\
    {APP_GUN1_BILL_TIMERID,0,10000,1,BillTimerCallback,&BillTimerPara[0]},\
    {APP_GUN2_BILL_TIMERID,0,10000,1,BillTimerCallback,&BillTimerPara[1]},\
}

int TTimer_Init(void);
void TTimer_Start(U32 timerid);
void TTimer_Stop(U32 timerid);
int TTimer_IsRunning(U32 timerid);
U32 TTimer_RemainTime(U32 timerid);
void TTimer_Loop(void);

 
#endif
